﻿using Futajma.MigrationStudio.DataDefinition;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Windows.Forms;
using System.Xml.Serialization;

namespace Futajma.MigrationStudio.GenericImporter
{
    [ObfuscationAttribute(Exclude = true, ApplyToMembers = true)]
    public delegate void BuildTreeUpdate(int steps, int count);

    [ObfuscationAttribute(Exclude = true, ApplyToMembers = true)]
    public interface IImporter
    {
        SharePointType GetSharePointType(DataNode dataNode);
        DataNode GetNewDataNode(int currentProjectVersion);
        XmlSerializer GetXmlSerializer();
        ImageList GetImageListList();
        // Shows the File Selection dialog to select a import object, like a file or folder
        DialogResult ShowDialog();
        
        // sets the configuration object without open the selection dialog
        void SetConfiguration(object configuration);

        // Imports the object, set via setConfiguration or selected by ShowDialog 
        void Import(TreeView tree, int currentVersion, bool loadItems = true);

        Dictionary<string, UpdateResult> DeltaUpdate(TreeView sourcetree, TreeView targetTree, int currentVersion);
        
        void SaveUpdateResult(Dictionary<string, UpdateResult> resultList, string path);

        event ProgressUpdate ProgressUpdate;
        event ProgressInit ProgressInit;
        event ProgressUpdateDone ProgressUpdateDone;

        void ImportDeploymentReport(TreeView targetTreeView, int version);
    }

    public interface FromFile
    {
        void Open(string file, TreeView tree, bool loadItems = true);

    }

    public interface FromStream
    {
        void Open(string file, TreeView tree);
    }
}
